import { FormOutlined } from "@ant-design/icons";
import { Space } from "antd";
import Title from "antd/es/typography/Title";
import styles from "./Logo.module.scss";
import { Link } from "react-router-dom";
import useGetUserInfo from "../hooks/useGetUserInfo";
import { useEffect, useState } from "react";
import { HOME_PATHNAME, MANAGE_INDEX_PATHNAME } from "../router";
export default function Logo() {
  const { username } = useGetUserInfo();
  const [pathname, setPathname] = useState(HOME_PATHNAME);
  useEffect(() => {
    if (username) {
      setPathname(MANAGE_INDEX_PATHNAME);
    }
  }, [name]);
  return (
    <div className={styles.container}>
      <Link to={pathname}>
        <Space>
          <Title>
            <FormOutlined></FormOutlined>
          </Title>
          <Title>小沐问卷</Title>
        </Space>
      </Link>
    </div>
  );
}
